package com.boesch.electroOffice.business.businessObjectImpl;

import java.io.Serializable;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.boesch.electroOffice.business.businessObject.IdentifierBusinessObject;
import com.boesch.electroOffice.dataaccess.common.IllegalDataAccessException;
import com.boesch.electroOffice.dataaccess.dao.IdentifierDao;
import com.boesch.electroOffice.model.electroOffice.Identifier;

/**
 * This class handles all the business logic 
 * for identifier class.
 * 
 * If there is no business logic, the class just calls the appropriate class
 * from package com.boesch.electroOffice.dataaccess to read the data from database.
 * 
 * 
 * @author Ralph Koster
 *
 */
@Service
public class IdentifierBusinessObjectImpl implements IdentifierBusinessObject, Serializable {

	private static final long serialVersionUID = -2941302286352358016L;

	@Autowired
	private IdentifierDao identifierDao;

	public Identifier getIdentifierById(int id) throws IllegalDataAccessException {
		return identifierDao.getIdentifierById(id);
	}

	public Identifier getIdentifierByEntityAndIdentifier(String entity, String identifier) throws IllegalDataAccessException {
		return identifierDao.getIdentifierByEntityAndIdentifier(entity, identifier);
	}

	public List<Identifier> readAllIdentifiers() throws IllegalDataAccessException {
		return identifierDao.readAllIdentifiers();
	}

	public List<Identifier> readIdentifiersByEntity(String entity) throws IllegalDataAccessException {
		return identifierDao.readIdentifiersByEntity(entity);
	}

	public List<Identifier> readIdentifiersByEntityAndSubentity(String entity, String subentity) throws IllegalDataAccessException {
		return identifierDao.readIdentifiersByEntityAndSubentity(entity, subentity);
	}
}
